? captcha-[893170].patch
? image_captcha/.image_captcha.admin.inc.swo
Index: image_captcha/image_captcha.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.admin.inc,v
retrieving revision 1.31
diff -u -p -r1.31 image_captcha.admin.inc
--- image_captcha/image_captcha.admin.inc	16 Mar 2010 21:12:01 -0000	1.31
+++ image_captcha/image_captcha.admin.inc	9 Nov 2010 21:23:13 -0000
@@ -170,6 +170,23 @@ function image_captcha_settings_form() {
     '#default_value' => (int) variable_get('image_captcha_noise_level', 5),
   );
 
+  // Texts
+  $form['image_captcha_responses'] = array(
+    '#type' => 'fieldset',
+    '#title'  => t('Text settings'),
+    '#description' => t('With these settings you can control text appearing in Image Captcha widget.'),
+  );
+  $form['image_captcha_responses']['captcha_response_title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Widget title'),
+    '#default_value' => variable_get('captcha_response_title', 'What code is in the image?'),
+  );
+  $form['image_captcha_responses']['captcha_response_description'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Widget description'),
+    '#default_value' => variable_get('captcha_response_description', 'Enter the characters shown in the image.'),
+  );
+
   // Add a validation handler.
   $form['#validate'] = array('image_captcha_settings_form_validate');
 
@@ -222,7 +239,7 @@ function _image_captcha_settings_form_fo
     variable_set('image_captcha_fonts_preview_map_cache', $fonts);
     // Put these fonts with preview image in the list
     foreach ($fonts as $token => $font) {
-      $img_src = check_url(url('admin/user/captcha/image_captcha/font_preview/'. $token));
+      $img_src = check_url(url('admin/config/people/captcha/image_captcha/font_preview/'. $token));
       $title = t('Font preview of @font (@file)', array('@font' => $font->name, '@file' => $font->filename));
       $available_fonts[$font->filename] = '<img src="'. $img_src .'" alt="'. $title .'" title="'. $title .'" />';
     }
@@ -231,13 +248,16 @@ function _image_captcha_settings_form_fo
     // and do not provide a preview for security reasons:
     // files in files directory can be uploaded by normal or even anonymous
     // users and should not be trusted.
-    $fonts = _image_captcha_get_available_fonts_from_directories(array(file_directory_path()));
+    $fonts = _image_captcha_get_available_fonts_from_directories(
+                array( file_default_scheme() . ':/' )
+              );
+
     foreach ($fonts as $font) {
       $available_fonts[$font->name] = $font->name ." ($font->filename)";
     }
 
     // Append the PHP built-in font at the end.
-    $img_src = check_url(url('admin/user/captcha/image_captcha/font_preview/BUILTIN'));
+    $img_src = check_url(url('admin/config/people/captcha/image_captcha/font_preview/BUILTIN'));
     $title = t('Preview of built-in font');
     $available_fonts['BUILTIN'] = t('PHP built-in font: !font_preview',
       array('!font_preview' => '<img src="'. $img_src .'" alt="'. $title .'" title="'. $title .'" />')
@@ -252,12 +272,12 @@ function _image_captcha_settings_form_fo
         array(
           '%fonts_library_general' => 'sites/all/libraries/fonts',
           '%fonts_library_specific' => conf_path() .'/libraries/fonts',
-          '%filesdir' => file_directory_path(),
+          '%filesdir' => file_default_scheme() . ':/',
         )
       ),
       '#options' => $available_fonts,
-      '#attributes' => array('class' => 'image_captcha_admin_fonts_selection'),
-      '#process' => array('expand_checkboxes', 'image_captcha_columnify_font_selection'),
+      '#attributes' => array('class' => array('image_captcha_admin_fonts_selection')),
+      '#process' => array('form_process_checkboxes', 'image_captcha_columnify_font_selection'),
     );
 
 
@@ -322,7 +342,7 @@ function _image_captcha_get_available_fo
   // Collect the font information.
   $fonts = array();
   foreach ($directories as $directory) {
-    foreach (file_scan_directory($directory, '\.[tT][tT][fF]$') as $filename => $font) {
+    foreach (file_scan_directory($directory, '/\.[tT][tT][fF]$/') as $filename => $font) {
       $fonts[md5($filename)] = $font;
     }
   }
@@ -413,7 +433,7 @@ function image_captcha_font_preview($fon
       exit();
     }
     // Get the font path.
-    $font = $fonts[$font_token]->filename;
+    $font = $fonts[$font_token]->uri;
     // Some sanity checks if the given font is valid.
     if (!is_file($font) || !is_readable($font)) {
       echo('bad font');
@@ -446,7 +466,7 @@ function image_captcha_font_preview($fon
   }
 
   // Set content type.
-  drupal_set_header("Content-type: image/png");
+  drupal_add_http_header("Content-type", "image/png");
   // Dump image data to client.
   imagepng($image);
   // Release image memory.
Index: image_captcha/image_captcha.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.info,v
retrieving revision 1.5
diff -u -p -r1.5 image_captcha.info
--- image_captcha/image_captcha.info	17 Feb 2008 12:49:24 -0000	1.5
+++ image_captcha/image_captcha.info	9 Nov 2010 03:02:38 -0000
@@ -3,4 +3,4 @@ name = "Image CAPTCHA"
 description = "Provides an image based CAPTCHA."
 package = "Spam control"
 dependencies[] = captcha
-core = 6.x
+core = 7.x
Index: image_captcha/image_captcha.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.module,v
retrieving revision 1.34
diff -u -p -r1.34 image_captcha.module
--- image_captcha/image_captcha.module	16 Mar 2010 21:12:01 -0000	1.34
+++ image_captcha/image_captcha.module	9 Nov 2010 05:50:08 -0000
@@ -34,8 +34,9 @@ function image_captcha_help($path, $arg)
  */
 function image_captcha_menu() {
   $items = array();
+
   // add an administration tab for image_captcha
-  $items['admin/user/captcha/image_captcha'] = array(
+  $items['admin/config/people/captcha/image_captcha'] = array(
     'title' => 'Image CAPTCHA',
     'file' => 'image_captcha.admin.inc',
     'page callback' => 'drupal_get_form',
@@ -43,14 +44,16 @@ function image_captcha_menu() {
     'access arguments' => array('administer CAPTCHA settings'),
     'type' => MENU_LOCAL_TASK,
   );
+
   // Menu path for generating font example.
-  $items['admin/user/captcha/image_captcha/font_preview'] = array(
+  $items['admin/config/people/captcha/image_captcha/font_preview'] = array(
     'title' => 'Font example',
     'file' => 'image_captcha.admin.inc',
     'page callback' => 'image_captcha_font_preview',
     'access arguments' => array('administer CAPTCHA settings'),
     'type' => MENU_CALLBACK,
   );
+
   // callback for generating an image
   $items['image_captcha'] = array(
     'file' => 'image_captcha.user.inc',
@@ -58,6 +61,7 @@ function image_captcha_menu() {
     'access callback' => TRUE,
     'type' => MENU_CALLBACK,
   );
+
   return $items;
 }
 
@@ -220,13 +224,13 @@ function image_captcha_captcha($op, $cap
         $img_src = check_url(url("image_captcha/$captcha_sid/". time()));
         $result['form']['captcha_image'] = array(
           '#type' => 'markup',
-          '#value' => '<img src="'. $img_src .'" alt="'. t('Image CAPTCHA') .'" title="'. t('Image CAPTCHA') .'" />',
+          '#markup' => '<img src="'. $img_src .'" alt="'. t('Image CAPTCHA') .'" title="'. t('Image CAPTCHA') .'" />',
           '#weight' => -2,
         );
         $result['form']['captcha_response'] = array(
           '#type' => 'textfield',
-          '#title' => t('What code is in the image?'),
-          '#description' => t('Enter the characters shown in the image.'),
+          '#title' => t(variable_get('captcha_response_title', 'What code is in the image?')),
+          '#description' => t(variable_get('captcha_response_description','Enter the characters shown in the image.')),
           '#weight' => 0,
           '#required' => TRUE,
           '#size' => 15,
Index: image_captcha/image_captcha.user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.user.inc,v
retrieving revision 1.26
diff -u -p -r1.26 image_captcha.user.inc
--- image_captcha/image_captcha.user.inc	20 Feb 2010 16:57:41 -0000	1.26
+++ image_captcha/image_captcha.user.inc	9 Nov 2010 05:46:24 -0000
@@ -18,7 +18,12 @@ function image_captcha_image($captcha_si
   }
 
   // Get solution (the code to show).
-  $code = db_result(db_query("SELECT solution FROM {captcha_sessions} WHERE csid = %d", (int)($captcha_sid)));
+  $code = db_query(
+      "SELECT solution FROM {captcha_sessions} WHERE csid = :csid", 
+      array( 
+        ':csid' => (int)($captcha_sid) 
+      ) 
+    )->fetchField();
 
   // Only generate captcha if code exists in the session.
   if ($code !== FALSE) {
